home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13918 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++,
  4. Subject: Re: Passing numbers
  5. Date: 27 Mar 1996 23:05:30 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4jchjq$i1k@news1.h1.usa.pipeline.com>
  8. References: <40.88694.1613@channel1.com>
  9. NNTP-Posting-Host: 38.8.60.7
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 27, 1996 06:28:00 in article <Passing numbers>,
  16. 'dspse.bedford@channel1.com (Dspse Bedford)' wrote: 
  17.  
  18.  
  19. >Lets say I have the following class and functions defined: 
  20. >class A{ 
  21. >... 
  22. >void func(long lvar); 
  23. >void func(int  ivar); 
  24. >.... 
  25. >}; 
  26. >I know that the compiler can not decide if  
  27. >A a; 
  28. >a.func(30); 
  29. >should match up with the int version of func or the long version of  
  30. >func.  However, is there anyway I can tell the compiler which one to  
  31. >use as a default definition such that the above would always be mapped 
  32. >to my default definition.  In other words, if an arguement, such as 
  33. >a number, causes an ambiguity use the default definition.  Does anyone 
  34. >know how or why not? 
  35.  
  36. Which compiler doesn't distinguish between int and long? 
  37. MSVC++4.1 does. 
  38.  
  39. a.func(30) => func(int); 
  40. a.func(5L) => func(long); 
  41.  
  42. -- 
  43. Pete Grant 
  44. Kalevi, Inc. 
  45. Software Engineering & development
  46.